require 'digest/sha1'
class User < ActiveRecord::Base
  has_many :scores
  def self.auth(id,pass)
    u=find_by_ident(id)
    return nil if u.nil?
    return u if User.encrypt(pass)==u.pwd.upcase
    nil 
  end

  protected
  
  def self.encrypt(pass)
    # Digest::SHA1.hexdigest(pass)
    pass.upcase
  end
  
end
